package api

import (
	"fmt"
	"hft/Database/admin"
	"hft/global"
	"hft/tools/weixin/model"
	"strings"
)

type Subscribe struct{}

// 接收微信的关注
func (*Subscribe) GetSub(sub *model.Subscribe) {
	fmt.Println(sub)
	// 绑定用户open_id

	var phone = strings.Split(sub.EventKey, "_")[1]

	var open_id = sub.FromUserName

	global.OC_DB.Model(&admin.Account{}).Where("phone = ?", phone).Update("open_id", open_id)

	// 关注后 订阅模板消息

}

var WeiXinSubscribe = new(Subscribe)
